<?php

namespace app\modules\admin\controllers;

use Yii;
use app\modules\admin\components\BaseAdminController;
use yii\web\Response;
use app\components\Log;

class LogController extends BaseAdminController
{
    /**
     * Displays homepage.
     */
    public function actionIndex()
    {
        $contents = Log::contents();
        return $this->render('index', [
            'contents' => $contents
        ]);
    }

    /**
     * clear log file
     */
    public function actionClear()
    {
        Log::clear();
        $this->redirect(['log/index']);
    }
}
